﻿namespace RotovapPlatform.Domain.Business.Recipes.Entities.Parameters;
using RotovapPlatform.Domain.Business.Machine.Enums;
using System.Collections.ObjectModel;
using System.Linq;
using static RotovapPlatform.Domain.Business.Machine.Enums.ExperimentConfigEnums;

public class RotovapParameters
{
	//旋蒸瓶选择    
	public RotaryBottleSize RotaryBottleType { get; set; }

	//待旋蒸物名称  
	public string MaterialName { get; set; }

	//待旋蒸物料瓶子位置（集合）    
	public ObservableCollection<int> MaterialLocations { get; set; } = new();

	//产物参数集合          
	public ObservableCollection<ProductParameters> ProductParameters { get; set; } = new();

	//残液参数
	public ResidualLiquidParameters ResidualLiquidParameters { get; set; }

	//清洗参数
	public CleaningParameters CleaningParameters { get; set; }

	/// <summary>
	/// 创建当前对象的深拷贝
	/// </summary>
	public RotovapParameters Clone()
	{
		return new RotovapParameters
		{
			RotaryBottleType = this.RotaryBottleType,
			MaterialName = this.MaterialName,
			MaterialLocations = new ObservableCollection<int>(this.MaterialLocations ?? new ObservableCollection<int>()),
			ProductParameters = new ObservableCollection<ProductParameters>(
				(this.ProductParameters ?? new ObservableCollection<ProductParameters>())
				.Select(p => p.Clone())
			),
			ResidualLiquidParameters = this.ResidualLiquidParameters?.Clone() ?? new ResidualLiquidParameters(),
			CleaningParameters = this.CleaningParameters?.Clone() ?? new CleaningParameters()
		};
	}
}

//产物配方参数类    
public class ProductParameters
{
	//油浴温度
	public double OilTemperature { get; set; }

	//是否阶梯升温
	public bool IsStepTemperature { get; set; }

	//阶梯温度 摄氏度              
	public double StepTemperature { get; set; }

	//阶梯稳定时间 min
	public double StepStableTime { get; set; }

	//是否智能温度判别
	public bool IsSmartTemperatureJudgment { get; set; }

	//旋蒸时间mim   
	public double RotaryTime { get; set; }

	//旋蒸转速 rpm
	public double RotarySpeed { get; set; }

	//真空度    
	public double Vacuum { get; set; }

	//冷凝温度 摄氏度
	public double CondensationTemperature { get; set; }

	//冷凝液是否收集
	public bool IsCondensationCollect { get; set; }

	//是否取样  
	public bool IsSampling { get; set; }

	//是否回中控台
	public bool IsBackToCCP { get; set; }

	/// <summary>
	/// 创建当前对象的深拷贝
	/// </summary>
	public ProductParameters Clone()
	{
		return new ProductParameters
		{
			OilTemperature = this.OilTemperature,
			IsStepTemperature = this.IsStepTemperature,
			StepTemperature = this.StepTemperature,
			StepStableTime = this.StepStableTime,
			IsSmartTemperatureJudgment = this.IsSmartTemperatureJudgment,
			RotaryTime = this.RotaryTime,
			RotarySpeed = this.RotarySpeed,
			Vacuum = this.Vacuum,
			CondensationTemperature = this.CondensationTemperature,
			IsCondensationCollect = this.IsCondensationCollect,
			IsSampling = this.IsSampling,
			IsBackToCCP = this.IsBackToCCP
		};
	}
}

//旋蒸残液参数类
public class ResidualLiquidParameters
{
	//残液是否收集  
	public bool IsResidualLiquidCollect { get; set; }

	//是否取样
	public bool IsSampling { get; set; }

	//旋蒸瓶残液收集瓶是否回中控台
	public bool IsResidualLiquidBackToCCP { get; set; }

	//旋蒸瓶是否回中控  
	public bool IsRotaryBottleBackToCCP { get; set; }

	/// <summary>
	/// 创建当前对象的深拷贝
	/// </summary>
	public ResidualLiquidParameters Clone()
	{
		return new ResidualLiquidParameters
		{
			IsResidualLiquidCollect = this.IsResidualLiquidCollect,
			IsSampling = this.IsSampling,
			IsResidualLiquidBackToCCP = this.IsResidualLiquidBackToCCP,
			IsRotaryBottleBackToCCP = this.IsRotaryBottleBackToCCP
		};
	}
}

//清洗参数类
public class CleaningParameters
{
	//是否清洗冷凝管
	public bool IsCondensationClean { get; set; }

	//冷凝管清洗液选择
	public string CondensationCleaningSolution { get; set; }

	//冷凝管清洗体积 ml
	public double CondensationCleaningVolume { get; set; }

	//冷凝管清洗速度 ml/min
	public double CondensationCleaningSpeed { get; set; }

	//是否清洗旋蒸瓶
	public bool IsRotaryBottleClean { get; set; }

	//旋蒸瓶清洗液选择
	public string RotaryBottleCleaningSolution { get; set; }

	//旋蒸瓶清洗体积 ml
	public double RotaryBottleCleaningVolume { get; set; }

	//旋蒸瓶清洗时间 min
	public double RotaryBottleCleaningTime { get; set; }

	/// <summary>
	/// 创建当前对象的深拷贝
	/// </summary>
	public CleaningParameters Clone()
	{
		return new CleaningParameters
		{
			IsCondensationClean = this.IsCondensationClean,
			CondensationCleaningSolution = this.CondensationCleaningSolution,
			CondensationCleaningVolume = this.CondensationCleaningVolume,
			CondensationCleaningSpeed = this.CondensationCleaningSpeed,
			IsRotaryBottleClean = this.IsRotaryBottleClean,
			RotaryBottleCleaningSolution = this.RotaryBottleCleaningSolution,
			RotaryBottleCleaningVolume = this.RotaryBottleCleaningVolume,
			RotaryBottleCleaningTime = this.RotaryBottleCleaningTime
		};
	}
}